package com.dexilaonian.activity;

import android.content.Intent;
import android.os.Handler;
import android.text.TextUtils;

import com.dexilaonian.MainActivity;
import com.dexilaonian.R;
import com.dexilaonian.ui.BaseActivity;
import com.dexilaonian.utils.Constant;
import com.dexilaonian.utils.PreferencesUtil;

public class SplashActivity extends BaseActivity {
    @Override
    public int getLayoutID() {
        return R.layout.activity_splash;
    }

    @Override
    public void initView() {

    }

    @Override
    protected void initData() {
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                String string = PreferencesUtil.getString(SplashActivity.this, Constant.SPLASH1);

                if (TextUtils.isEmpty(string)) {
                    Intent intent = new Intent(SplashActivity.this, GuideActivity.class);
                    startActivity(intent);
                    finish();
                } else {
                    Intent intent = new Intent(SplashActivity.this, MainActivity.class);
                    startActivity(intent);
                    finish();
                }
            }
        }, 2000);
    }

    private String getToken() {
        String key = PreferencesUtil.getString(SplashActivity.this, Constant.KEY);
        return key;
    }

}
